sql
c
python
database
ruby-on-rails
multithreading
flash
json
perl
algorithm
facebook
cocoa
tsql
delphi
apache
php5
asp
api
postgresql
dom
Why not load the GIF in a hidden div and then when you need it add the tag for it in your target location. The browser will have cached it from the first request so it should show right away.
AFAIK, there is no way to restart a .gif from JavaScript.
You should be able to reload it by setting the src to the same thing with a query string on the end. (sorry, I'm using jQuery to be efficient with my time, lol)
$('#myImg').attr('src', $('#myImg').attr('src') + '?' + (new Date()).valueOf());
The downside is it will force the gif to download again before it restarts. So the next thing you'd want to do is implement some sort of preloader to preload the replacement gif from the new src.
var rplImg; function preloadReplacement() { rplImg = new Image(); var d = new Date(); rplImg.src = "some.gif?" + d.valueOf(); } $(function() { preloadReplacement(); $('#myImg').click(function(){ $(this).attr('src', rplImg.src); preloadReplacement(); }); });
This is untested, but it's the basic idea.